package com.llkj.qingnianguoxue.adapter;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.SpinnerAdapter;
import android.widget.TextView;

import com.llkj.qingnianguoxue.R;

import java.util.List;

/**
 *  提现银行适配器
 */

public class BankSpinnerAdapter extends BaseAdapter implements SpinnerAdapter {
    private Context mContext;
    private List<String> mData;
    private LayoutInflater inflater;
    public BankSpinnerAdapter(Context context, List<String> list){
        mContext = context;
        mData = list;
        inflater = LayoutInflater.from(context);
    }
    @Override
    public int getCount() {
        return mData.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        View deniedView = inflater.inflate(R.layout.item_dialog_denied,null);
        TextView tvContent = (TextView) deniedView.findViewById(R.id.tvContent);
        tvContent.setBackgroundColor(ContextCompat.getColor(mContext, R.color.colorF6F6F6));
        tvContent.setText(mData.get(i));
        View lineBottom = deniedView.findViewById(R.id.line_bottom);
        lineBottom.setVisibility(View.INVISIBLE);
        return deniedView;
    }

    @Override
    public View getDropDownView(int position, View convertView, ViewGroup parent) {
        View deniedView = inflater.inflate(R.layout.item_dialog_denied,null);
        TextView tvContent = (TextView) deniedView.findViewById(R.id.tvContent);
        tvContent.setText(mData.get(position));
        return deniedView;
    }
}
